package com.zhou.base.components.feign.cloud.controller;

import com.zhou.base.components.bs.common.model.Response;
import com.zhou.base.components.feign.cloud.feign.TestServiceNameFeign;
import com.zhou.base.components.feign.cloud.feign.TestUrlFeign;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 测试类
 *
 * @author xianfeng
 * @date 2023/11/22 16:21
 * @description:
 */
@RequiredArgsConstructor
@RefreshScope
@RestController
@RequestMapping("/test")
public class TestController {

    private final TestServiceNameFeign testServiceNameFeign;
    private final TestUrlFeign testUrlFeign;

    @Value("${test.param:testParam1}")
    private String testParam;
    @Value("${server.port}")
    private Integer serverPort;

    /**
     * 普通接口
     *
     * @return
     */
    @GetMapping
    public Response test1() {
        return Response.success(testParam);
    }

    @GetMapping("/getServerPort")
    public Response<Integer> getServerPort() {
        return Response.success(serverPort);
    }
}
